View Javadoc
1 package jrre; 2 3 import jrre.types.*; 4 import jrre.gui.NativeStackFrameGui; 5 6 import jrre.instructionset.Instruction; 7 import jrre.classloader.classfile.attributes.LocalVariableAttributeTable; 8 9 /*** 10 * 11 * 12 * @author Christopher Ellsworth (Chris@chrisellsworth.com) 13 * @author Clerance Alston (massclax@hotmail.com) 14 */ 15 public class NativeStackFrame { 16 17 private NativeStackFrameGui stackFrameGui; 18 19 private NativeStackFrame nextFrame; 20 private NativeStackFrame previousFrame; 21 22 private Instruction instructions; 23 24 //private int [] byteCode; 25 private OperandStack operandStack; 26 private int stackPointer=0; 27 private LocalVariableFrame localVariableFrame; 28 29 private int localVariableSize; 30 private LocalVariableAttributeTable localVariableTable; 31 32 public NativeStackFrame(){ 33 34 if(JRRE.guiOn()){ 35 stackFrameGui = new NativeStackFrameGui(); 36 } 37 38 operandStack = new OperandStack(); 39 localVariableFrame = new LocalVariableFrame(); 40 } 41 42 public Type getLocalVariable(int variableIndex){ 43 return localVariableFrame.getLocalVariable(variableIndex); 44 } 45 46 public void setLocalVariable(int variableIndex, Type value){ 47 48 localVariableFrame.setLocalVariable(variableIndex, value); 49 } 50 51 /*** 52 * Gets the Instructions. 53 */ 54 public Instruction getInstructions(){ 55 return this.instructions; 56 } 57 58 /*** 59 * Sets the Instructions. 60 * @param Instructions The value to set it to. 61 */ 62 public void setInstructions(Instruction instructions){ 63 this.instructions = instructions; 64 } 65 66 /*** 67 * Gets the LocalVariableTable. 68 */ 69 public LocalVariableAttributeTable getLocalVariableTable(){ 70 return this.localVariableTable; 71 } 72 73 /*** 74 * Sets the LocalVariableTable. 75 * @param LocalVariableTable The value to set it to. 76 */ 77 public void setLocalVariableTable(LocalVariableAttributeTable localVariableTable){ 78 this.localVariableTable = localVariableTable; 79 80 81 } 82 83 /*** 84 * Gets the LocalVariableSize. 85 */ 86 public int getLocalVariableSize() { 87 return this.localVariableSize; 88 } 89 90 /*** 91 * Sets the LocalVariableSize. 92 * @param LocalVariableSize The value to set it to. 93 */ 94 public void setLocalVariableSize(int localVariableSize){ 95 this.localVariableSize = localVariableSize; 96 97 localVariableFrame.setSize(localVariableSize); 98 } 99 100 public void pushOperand(Type variable){ 101 operandStack.push(variable); 102 } 103 104 public Type popOperand(){ 105 return operandStack.pop(); 106 } 107 108 /*** 109 * Gets the ByteCode. 110 */ 111 /* 112 public int [] getByteCode(){ 113 return this.byteCode; 114 } 115 */ 116 /*** 117 * Sets the ByteCode. 118 * @param ByteCode The value to set it to. 119 */ 120 /* 121 public void setByteCode(int [] byteCode){ 122 this.byteCode = byteCode; 123 } 124 */ 125 /* 126 public int getNextInstruction(){ 127 if(stackPointer < byteCode.length) 128 return byteCode[stackPointer++]; 129 else 130 return -1; 131 // fix this 132 } 133 */ 134 public Instruction getNextInstruction(){ 135 136 Instruction toReturn = instructions; 137 138 if(instructions != null) 139 instructions = instructions.getNextInstruction(); 140 return toReturn; 141 } 142 }

This page was automatically generated by Maven